package behaviour.template.template_demo2;

import java.util.stream.IntStream;

/**
 * @author yeyangtao created at 14:30 2020/11/5
 */
abstract class ApplicationFramework{
    public ApplicationFramework() {
        templateMethod();
    }
    abstract void customize1();
    abstract void customize2();
    private void templateMethod(){
        IntStream.range(0,5).forEach(n->{
            customize1();
            customize2();
        });
    }
}
class MyApp extends ApplicationFramework{

    @Override
    void customize1() {
        System.out.print("hello ");
    }

    @Override
    void customize2() {
        System.out.println("world!");
    }
}
public class TemplateMethod {
    public static void main(String[] args) {
        new MyApp();
    }
}
